package com.liusand.user.thread;

import com.liusand.entity.pojo.User;

/**
 * @author :liusha
 * packageName :com.liusand.common.utils
 * fileName :ThreadLocalUtils
 * creationTime :2022/12/12 20:26
 */
public class UserThreadLocalUtil {
    private static ThreadLocal<User> threadLocal = new ThreadLocal<>();

    public static void setThreadLocal(User user){
        threadLocal.set(user);
    }

    public static String getId(){
        return threadLocal.get().getId();
    }

    public static String getPhone(){
        return threadLocal.get().getPhone();
    }

    public static void remove(){
        threadLocal.remove();
    }
}
